package com.ting.etp.loader.enums;

import com.ting.etp.common.exception.EtpException;

/**
 * 开发模式key定义
 *
 * @author zifang
 */
public enum  DevelopmentModeEnum {
    ISOLATION("isolation","隔离模式"),
    COEXIST("coexist","共存模式"),
    ;


    private String code;
    private String description;

    DevelopmentModeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static DevelopmentModeEnum checkModeKey(DevelopmentModeEnum developmentModeEnum){
        if (developmentModeEnum == null){
            throw new EtpException("开发模式不能为空");
        }
        for (DevelopmentModeEnum value : values()) {
            if (value.equals(developmentModeEnum)){
                return value;
            }
        }
        throw new EtpException("不支持的开发模式");
    }
}
